import request from '@/utils/request';
import { AxiosPromise } from 'axios';

/**
 * 查询账户信息列表
 * @param query
 * @returns {*}
 */

export const listAccount = (query?: AccountVO): AxiosPromise<AccountVO[]> => {
  return request({
    url: '/fms/account/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询账户信息详细
 * @param id
 */
export const getAccount = (id: string | number): AxiosPromise<AccountVO> => {
  return request({
    url: '/fms/account/' + id,
    method: 'get'
  });
};

/**
 * 新增账户信息
 * @param data
 */
export const addAccount = (data: AccountVO) => {
  return request({
    url: '/fms/account',
    method: 'post',
    data: data
  });
};

/**
 * 修改账户信息
 * @param data
 */
export const updateAccount = (data: AccountVO) => {
  return request({
    url: '/fms/account',
    method: 'put',
    data: data
  });
};

/**
 * 删除账户信息
 * @param id
 */
export const delAccount = (id: number | Array<undefined | number>) => {
  return request({
    url: '/fms/account/' + id,
    method: 'delete'
  });
};


export interface AccountVO extends BaseEntity, PageQuery {
  /**
   * 主键
   */
  id?: number;

  /**
   * 名称
   */
  name?: string;

  /**
   * 编号
   */
  accountNo?: string;

  /**
   * 当前余额
   */
  balance?: number;

  /**
   * 启用
   */
  status?: string;

  /**
   * 排序
   */
  sort?: number;

  /**
   * 账户归属
   */
  partnerId?: number;

  /**
   * 备注
   */
  remark?: string;

  /**
   * 更新时间
   */
  updateTime?: string;

}
